package redis_help

import (
	"fmt"

	"servers/models/define"
)

const (
	TokenToUserID       = "login:to_user_id:%s"
	UserIDToToken       = "login:to_token:%d"
	LoginGateway        = "login:gateway:%s"
	UserOnlineTime      = "user_online:time"
	UserOnlineMax       = "user_online:max:%d"
	ActiveUserKeys      = "active_user_keys:%d"
	UserNewLogin        = "new_user_login:%d:%v:%v"
	UserNewLoginScan    = "new_user_login:%d:*"
	UserNewBet          = "new_user_bet:%d:%v:%v"
	UserNewBetScan      = "new_user_bet:%d:*"
	UserActiveLogin     = "active_user_login:%d:%v:%v"
	UserActiveLoginScan = "active_user_login:%d:*"
	UserActiveBet       = "active_user_bet:%d:%v:%v"
	UserActiveBetScan   = "active_user_bet:%d:*"
)

func KeyTokenToUserID(token string) string {
	return fmt.Sprintf(TokenToUserID, token)
}

func KeyUserIDToToken(uid define.UserIDType) string {
	return fmt.Sprintf(UserIDToToken, uid)
}

func KeyLoginGateway(linkBidUid string) string {
	return fmt.Sprintf(LoginGateway, linkBidUid)
}

func KeyOnlineUserTime() string {
	return UserOnlineTime
}

func KeyOnlineUserMax(zeroTime int64) string {
	return fmt.Sprintf(UserOnlineMax, zeroTime)
}

func KeyActiveUserKeys(zeroTime int64) string {
	return fmt.Sprintf(ActiveUserKeys, zeroTime)
}

func KeyNewUserLoginScan(zeroTime int64) string {
	return fmt.Sprintf(UserNewLoginScan, zeroTime)
}

func KeyNewUserLogin(zeroTime int64, gameKind define.GameKind, bid define.BusinessIDType) string {
	return fmt.Sprintf(UserNewLogin, zeroTime, gameKind, bid)
}

func KeyNewUserBetScan(zeroTime int64) string {
	return fmt.Sprintf(UserNewBetScan, zeroTime)
}

func KeyNewUserBet(zeroTime int64, gameKind define.GameKind, bid define.BusinessIDType) string {
	return fmt.Sprintf(UserNewBet, zeroTime, gameKind, bid)
}

func KeyActiveUserLoginScan(zeroTime int64) string {
	return fmt.Sprintf(UserActiveLoginScan, zeroTime)
}

func KeyActiveUserLogin(zeroTime int64, gameKind define.GameKind, bid define.BusinessIDType) string {
	return fmt.Sprintf(UserActiveLogin, zeroTime, gameKind, bid)
}

func KeyActiveUserBetScan(zeroTime int64) string {
	return fmt.Sprintf(UserActiveBetScan, zeroTime)
}

func KeyActiveUserBet(zeroTime int64, gameKind define.GameKind, bid define.BusinessIDType) string {
	return fmt.Sprintf(UserActiveBet, zeroTime, gameKind, bid)
}
